package com.chdwmp.product.constant;

public enum Status {
    /**********************************************************************************
     * 1开头 系统模块
     **********************************************************************************/

    SUCCESS(0, "成功"),
    SYSTEM_ERROR(10001, "系统异常"),
    MISS_REQUIRED_PARAMETER(10002, "缺失必要参数"),
    NO_TEST_SERIAL_NUMBER(10003, "已经没有测试序列号了"),
    USER_IS_NOT_EXITS(1004,"用户不存在"),
    ERROR_INCORRECT_USERNAME_OR_PASSWORD(20001, "账号或密码错误，请重新填写"),



    /**********************************************************************************
     * 3开头 用户购买注册模块
     **********************************************************************************/
    ORDER_FAIL(30001,"下单失败"),
    ORDER_PRICE_LESS_THAN_ZERO(30002, "支付金额小于0"),
    PAY_SUCCESS(30003, "支付成功"),
    PAY_FAIL(30004, "支付失败"),
    DOCTOR_NOT_EXIST(30011,"该二维码异常，请联系管理员"),
    SMS_CODE_PAST_DUE(30013, "验证码已过期，请重新请求"),
    REGISTERED(30014, "您已注册成功，无需重复购买"),
    PREPAY_ERROR(30015, "您已请求购买，无需重复请求"),
    PREPAY_CREATE_ERROR(30016, "生成订单失败，请联系管理员"),
    ORDER_NOT_EXISTS(30017, "订单信息不存在"),


    PRODUCT_IS_EXITS(40001,"产品已经存在"),



    ;

    private Integer code;
    private String msg;

    private Status(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsg(Integer code) {
        for (Status value : Status.values()) {
            if (value.getCode().equals(code)) {
                return value.msg;
            }
        }
        return "";
    }

    public Integer getCode() {
        return code;
    }

    private void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    private void setMsg(String msg) {
        this.msg = msg;
    }
}
